import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import { fileURLToPath } from 'node:url'
import path from 'path'

// https://vite.dev/config/
export default defineConfig({
  plugins: [vue()],
  css: {
    preprocessorOptions: {
      scss: {
        // additionalData: '@import "./src/styles/variable.scss";',
        additionalData: `@use "/src/styles/variable.scss" as *;`,
      },
    },
  },
  resolve: {
    alias: {
      '@': path.resolve(__dirname, 'src')
    }
  },
  //跨域处理，解决后端接口跨域问题
  server: {
    proxy: {
      // '/admin': {
      //   target: 'http://3349c605.r30.cpolar.top',
      //   changeOrigin: true,
      // },
      // '/login': {
      //   target: 'http://3349c605.r30.cpolar.top',
      //   changeOrigin: true,
      // },
      // '/checkProvincesMunicipalities': {
      //   target: 'http://3349c605.r30.cpolar.top',
      //   changeOrigin: true,
      // },
    }
  }
})
